/**
 * VYPe11 Project
 * VYPe11 language compiler.
 * Authors: Jozef Lang (xlangj01), 
 * 			Zoltan Zemko (xzemko01)
 * 2011
 */
package cz.vutbr.fit.VYPe.team18.VYPe11.nodes.expression.literal;

import java.io.IOException;

import cz.vutbr.fit.VYPe.team18.VYPe11.nodes.Node;
import cz.vutbr.fit.VYPe.team18.VYPe11.nodes.data_type.DataType;

public class Literal extends Node {
	private Object value;
	private DataType type;
	
	public Literal(Object value) throws Exception {
		this.value=value;
		
		if(this.value instanceof Integer)
			this.type=DataType.INT;
		else if(this.value instanceof Short)
			this.type=DataType.SHORT;
		else if(this.value instanceof Character)
			this.type=DataType.CHAR;
		else if(this.value instanceof String)
			this.type=DataType.STRING;
		else
			throw new Exception("Unknown literal type:"+this.value);
	}
	
	public Object getValue() {
		return value;
	}

	public DataType getType() {
		return type;
	}
	
	@Override
	public void generateTAC() throws IOException {

	}
}
